package org.az.netty_study.p15_netty参数;

import cn.hutool.log.Log;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelOption;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LoggingHandler;

/**
 * 对于服务端ServerBootstrap，有option()和childOption()
 *  1.option()：给ServerSocketChannel设置参数
 *  2.childOption()：给SocketChannel设置参数
 */
public class _2_服务端参数 {
    public static void main(String[] args) {
        ServerBootstrap server = new ServerBootstrap()
                //SO_BACKLOG，设置全连接队列(三次握手后连接真正建立，该连接就会被放到全连接队列，accept()就从这个队列里获取连接对象)大小
                .option(ChannelOption.SO_BACKLOG, 1)
                .group(new NioEventLoopGroup())
                .channel(NioServerSocketChannel.class)
                .childHandler(new LoggingHandler());

        server.bind(8080);
    }
}
